<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\Goods */

$this->title = $model->name.'-锐锋堂刀剑网';
$this->params['breadcrumbs'][] = [
    'label' => 'Goods',
    'url' => [
        'index'
    ]
];
$this->registerMetaTag([
    'name' => 'keywords',
    'content' => $this->title
]);
$description="总长：{$model->sumlen}cm刃长：{$model->bladelen}cm柄长：{$model->stemlen}cm刃宽：{$model->width}cm刃厚：{$model->height}硬度：{$model->hard}hrc刃材：{$model->stuff}</td>鞘材：{$model->sheath}装具：{$model->grind}工艺：{$model->craftwork}重量：{$model->weight}kg赠品：{$model->gift}";
$this->registerMetaTag([
    'name' => 'description','content'=>$description]);
$this->params['breadcrumbs'][] = $this->title;
$this->registerCssFile('/css/common.css');
$this->registerCssFile('/fonts/iconfont.css');
$this->registerCssFile('/css/show.css');
$this->registerCssFile('/css/goods.css');
$this->registerJsFile('/js/footer.js');
$this->registerJsFile('/js/common_js.js');
$this->registerJsFile('/js/jqzoom.js');
$this->registerJsFile('/layer/layer.js');
$this->registerJsFile('/js/public.js');
$this->registerJs('
    $(".colors").click(function(){
    $(".colors").removeClass("selected");
    $(this).addClass("selected");
    $("#ECS_SHOPPRICE").html("<i>￥</i>"+$(this).attr("price"));
    $("input[name=tid]").val($(this).attr("data"));
});
    ');
?>
<!--产品详细页样式-->
<div class="clearfix Inside_pages">
	<div class="Location_link">
		<em></em><a href="<?=Url::to('/site/index.html')?>">首页</a> &lt; <a
			href="<?=Url::to('/goods/index-'.$col->id.'.html')?>"><?=$col->name?></a>
	</div>
	<!--产品详细介绍样式-->
	<div class="clearfix" id="goodsInfo">
		<!--产品图片放大-->
		<div class="mod_picfold clearfix">
			<div class="clearfix" id="detail_main_img">
				<div class="layout_wrap preview">
					<div id="vertical" class="bigImg">
						<img src="<?=str_replace('mid', 'self',$model->logo)?>" width=""
							height="" alt="" id="midimg" />
						<div id="winSelector"></div>
					</div>
					<div class="smallImg">
						<div class="scrollbutton smallImgUp disabled">&lt;</div>
						<div id="imageMenu">
							<ul>
								<li><img src="<?=str_replace('mid', 'small',$model->logo)?>"
									width="68" height="68" alt="<?=$model->name?>" /></li>
				<?php if(!empty($imgs)):?>
				<?php foreach($imgs as $val):?>
				<li><img src="<?=str_replace('mid','small',$val['name'])?>"
									width="68" height="68" alt="<?=$model->name?>" /></li>
				<?php endforeach;?>
				<?php endif;?>
			</ul>
						</div>
						<div class="scrollbutton smallImgDown">&gt;</div>
					</div>
					<!--smallImg end-->
					<div id="bigView" style="display: none;">
						<div>
							<img width="800" height="800" alt="<?=$model->name?>" src="" />
						</div>
					</div>
				</div>
			</div>
			<div class="Sharing">
				<div class="bdsharebuttonbox bdshare-button-style0-16"
					data-bd-bind="1441079683326">
					<a href="#" class="bds_more" data-cmd="more">分享到：</a><a href="#"
						class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#"
						class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#"
						class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#"
						class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a
						href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
				</div>
				<script>
window._bd_share_config={"common":{
	"bdSnsKey":{},
	"bdText":"<?=$this->title?>",
	"bdMini":"2",
	"bdMiniList":false,
	"bdPic":"http://www.daojianchang.com<?=$model->logo?>",
	"bdStyle":"0",
	"bdSize":"16"},"share":{"bdSize":16},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
				<!--收藏-->
				<div class="Collect">
					<a href="javascript:;" onclick='collect(<?=$model->id?>)'><em class="ico1"></em>收藏商品</a>
				</div>
			</div>
		</div>
		<!--产品信息-->
		<div class="property">
		
				<h2><?=$model->name?></h2>
				<div class="goods_info"></div>
				<div class="ProductD clearfix">
					<div class="productDL">
						<dl>
							<dt>售&nbsp;&nbsp;&nbsp;&nbsp;价：</dt>
							<dd>
								<span id="ECS_SHOPPRICE"><i>￥</i><?=$model->price?></span>
							</dd>
						</dl>
						<dl>
							<dt>重&nbsp;&nbsp;&nbsp;&nbsp;量：</dt>
							<dd><?=$model->weight?>千克</dd>
						</dl>
						<dl>
							<dt>规&nbsp;&nbsp;&nbsp;&nbsp;格：</dt>
							<dd>
								<?php if(!empty($colors)):?>
								<?php foreach ($colors as $val):?>
								<div class="item colors" data='<?=$val['id']?>' price='<?=$val['price']?>'>
									<b></b><a href="#none" title="<?=$val['name']?>"><?=$val['name']?></a>
								</div>
								<?php endforeach;?>
								<?php else:?>
								<div class="item  selected">
									<b></b><a href="#none" title="全款">全款</a>
								</div>
								<?php endif;?>
							</dd>
						</dl>
						<dl>
							<dt>单&nbsp;&nbsp;&nbsp;&nbsp;位：</dt>
							<dd>把</dd>
						</dl>
					</div>
				</div>
				<?php ActiveForm::begin(['action'=>'/goods/order.html','id'=>'order-form'])?>
				<input type='hidden' name='oid' value="<?=$model->id?>">
				<input type='hidden' name='tid' value=0>
				<div class="buyinfo" id="detail_buyinfo">
					<dl>
						<dt>数量</dt>
						<dd>
							<div class="choose-amount left">
								<a class="btn-reduce" href="javascript:;"
									onclick="setAmount.reduce('#buy-num')">-</a> <a class="btn-add"
									href="javascript:;" onclick="setAmount.add('#buy-num')">+</a> <input
									class="text" name='num' id="buy-num" value="1"
									onkeyup="setAmount.modify('#buy-num');">
							</div>
							<div class="P_Quantity">剩余：<?=$model->num?>件</div>
						</dd>
					</dl>
					<dl>
					<dd>
					<div class="wrap_btn">
								<a href="javascript:;" onclick="ShowDiv_1('MyDiv1','fade1',<?=$model->id?>)" class="wrap_btn1"
									title="加入购物车"></a> <a href="javascript:;"
									class="wrap_btn2" onclick='$("#order-form").submit()' title="立即购买"></a>
					</div>
					</dd>
					</dl>
				</div>
				<?php ActiveForm::end()?>
				<div class="Guarantee clearfix">
					<dl>
						<dt>支付方式</dt>
						<dd>
							<em></em>货到付款（部分地区）
						</dd>
						<dd>
							<em></em>在线支付
						</dd>
					</dl>
				</div>
		</div>
		<!--推荐-->
		<div class="p_right_info">
			<div class="Brands">
				<a href="#" style="padding-top: 10px;"><img src="/products/logo/log.png" width="60"
					height="57" /></a>
				<h5>锐锋堂</h5>
			</div>
			<div class="Recommend">
				<div class="title_name">同类产品推荐</div>
				<div class="Recommend_list">
					<ul>
					<?php if(!empty($similar)):?>
					<?php foreach ($similar as $val):?>
						<li class="clearfix">
							<div class="pic_img">
								<a href=""><img src="<?=$val['logo']?>"
									data-bd-imgshare-binded="1"></a>
							</div>
							<div class="r_content">
								<div class="title">
									<a href="#"><?=mb_strimwidth($val['name'], 0,40, '...','utf8')?></a>
								</div>
								<div class="p_Price">￥<?=$val['price']?></div>
								<a href="javascript:; title=" 加入购物车"="" onclick="ShowDiv_1('MyDiv1','fade1',117)" class="Shopping">加入购物车</a>
							</div>
						</li>
						<?php endforeach;?>
					<?php endif;?>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!--样式-->
	<div class="clearfix">
		<div class="left_style">
			<div class="user_Records">
				<div class="title_name">销量排行</div>
				<ul>
	 <?php if(!empty($hot)):?>
	 <?php foreach ($hot as $val):?>
	  <li><a href="/goods/view-<?=$val['id']?>.html">
							<p>
								<img src="<?=$val['logo']?>" data-bd-imgshare-binded="1">
							</p>
							<p class="p_name"><?=$val['name']?></p>
					</a>
						<p>
							<span class="p_Price"><i>￥</i><?=$val['price']?></span>
							<a href="javascript:;" title="加入购物车" onclick="ShowDiv_1('MyDiv1','fade1',<?=$val['id']?>)" class="Shopping">加入购物车</a>
						</p></li>
	  <?php endforeach;?>
	  <?php endif;?>
	 </ul>
			</div>
		</div>
		<!--介绍信息样式-->
		<div class="right_style">
			<div class="inDetail_boxOut ">
				<div class="inDetail_box">
					<div class="fixed_out ">
						<ul class="inLeft_btn fixed_bar">
							<li class="active"><a id="property-id" href="#p_attribute"
								class="current">规格与包装</a></li>
							<li><a id="detail-id" href="#shangpjs">商品详情</a></li>
							<!-- <li><a id="shot-id" href="#miqsp">售后服务</a></li>
							<li><a id="coms1-id" href="#status2">买家评论(12)</a></li> -->
						</ul>
						<div class="subbuy">
							<span class="extra currentPrice"> ¥<?=$model->price?></span> <a href="#"
								class="extra  notice J_BuyButtonSub">立即购买</a>
						</div>
					</div>
				</div>
			</div>
			<div class="des_con" id="p_attribute">

				<table border="0" align="center"
					style="width: 100%; font-family: '宋体'; margin: 10px auto;"
					cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<td>总长：<?=$model->sumlen?>cm</td>
							<td>刃长：<?=$model->bladelen?>cm</td>
							<td>柄长：<?=$model->stemlen?>cm</td>
							<td>刃宽：<?=$model->width?>cm</td>
						</tr>
						<tr>
							<td>刃厚：<?=$model->height?>cm</td>
							<td>硬度：<?=$model->hard?>hrc</td>
							<td>刃材：<?=$model->stuff?></td>
							<td>鞘材：<?=$model->sheath?></td>
						</tr>
						<tr>
							<td>装具：<?=$model->grind?></td>
							<td>工艺：<?=$model->craftwork?></td>
							<td>重量：<?=$model->weight?>kg</td>
							<td>赠品：<?=$model->gift?></td>
						</tr>
						<tr>

							<td></td>
							<td></td>
							<td></td>
						</tr>
					</tbody>
				</table>


			</div>
			<div id="shangpjs" class="info_style" style="text-align: center;"><?=$model->message?></div>
			<!-- 
			<div class="productContent" id="status2">
				<div class="iComment clearfix">
					<div class="rate">
						<strong id="goodRate">100<span>%</span></strong><br> <span>好评度</span>
					</div>
					<div class="percent" id="percentRate">
						<dl>
							<dt>
								好评<span>(100%)</span>
							</dt>
							<dd>
								<div style="width: 100px;"></div>
							</dd>
						</dl>
						<dl>
							<dt>
								中评<span>(0%)</span>
							</dt>
							<dd class="d1">
								<div style="width: 0;"></div>
							</dd>
						</dl>
						<dl>
							<dt>
								差评<span>(0%)</span>
							</dt>
							<dd class="d1">
								<div style="width: 0;"></div>
							</dd>
						</dl>
					</div>
					<div class="actor">
						<dl>
							<dt>
								发表评价即可获得10积分，精华评论更有 <font color="red">额外奖励</font> 积分；<br>
								还有7个多倍积分名额哦，赶紧抢占吧！<br> 只有购买过该商品的用户才能进行评价。
							</dt>
							<dd>
								<input type="submit" class="Publication_btn" title=""
									onclick="send_cooment()" value="发表评论">
							</dd>
						</dl>
					</div>
				</div>
				<div class="commentBox" style="display: none;">
					<form action="javascript:;" onsubmit="submitComment(this)"
						method="post" name="commentForm" id="commentForm">
						<h3>商品评分</h3>
						<div id="star">
							<ul>
								<li><span onclick="dorank(1)"></span>
									<p>1分</p>
									<p>非常不满意</p></li>
								<li><span onclick="dorank(2)"></span>
									<p>2分</p>
									<p>不满意</p></li>
								<li><span onclick="dorank(3)"></span>
									<p>3分</p>
									<p>一般</p></li>
								<li><span onclick="dorank(4)"></span>
									<p>4分</p>
									<p>满意</p></li>
								<li><span onclick="dorank(5)"></span>
									<p>5分</p>
									<p>非常满意</p></li>
							</ul>
							<input type="hidden" name="rank" id="rank" value="1"> <input
								type="hidden" name="cmt_type" value=""> <input type="hidden"
								name="id" value="78"> <input type="hidden" name="email"
								id="email" value="null@mial.com">
						</div>
						<h4>评论内容</h4>
						<div class="bd">
							<textarea name="content" id="content" class="textarea_long"
								onkeyup="checkLength(this);"></textarea>
							<p class="g">
								<label>&nbsp; </label> <input type="submit" value="发表"
									class="btn_common"> <span t="word_calc" class="word"><b id="sy">0</b>/1000</span>
							</p>
						</div>
					</form>
				</div>
				<div id="ECS_COMMENT">
					<div class="Comment">
						<div class="CommentTab">
							<ul>
								<li class="active" onclick="javascript:gotoPage(1,78,0,0);">全部评论(0)</li>
								<li onclick="javascript:gotoPage(1,78,0,3);">好评(0)</li>
								<li onclick="javascript:gotoPage(1,78,0,2);">中评(0)</li>
								<li onclick="javascript:gotoPage(1,78,0,1);">差评(0)</li>
							</ul>
						</div>
						<div class="CommentText" id="goodsdetail_comments_list"
							style="display: block">
							<ul class="clearfix">
							</ul>
							<div class="comment_page clearfix">
								<div class="comment_Number">
									<span class="f_l f6" style="margin-right: 10px;">共 <b>0</b> 条评论
									</span>
									<div id="comment_Pager_Number" class="comment_Pager_Number">
										<a href="javascript:gotoPage(1,78,0,0)">首页</a> <a class="prev"
											href="javascript:;">上一页</a> <a class="next"
											href="javascript:;">下一页</a> <a class="last"
											href="javascript:;">尾页</a>
									</div>
								</div>
							</div>
						</div>
					</div>
					<script type="text/javascript">
//<![CDATA[
var cmt_empty_username = "请输入您的用户名称";
var cmt_empty_email = "请输入您的电子邮件地址";
var cmt_error_email = "电子邮件地址格式不正确";
var cmt_empty_content = "您没有输入评论的内容";
var captcha_not_null = "验证码不能为空!";
var cmt_invalid_comments = "无效的评论内容!";

/**
 * 提交评论信息
*/
function submitComment(frm)
{
  var cmt = new Object;
  cmt.email           = frm.elements['email'].value;
  cmt.content         = frm.elements['content'].value;
  cmt.type            = frm.elements['cmt_type'].value;
  cmt.id              = frm.elements['id'].value;
  cmt.enabled_captcha = frm.elements['enabled_captcha'] ? frm.elements['enabled_captcha'].value : '0';
  cmt.captcha         = frm.elements['captcha'] ? frm.elements['captcha'].value : '';
  cmt.rank            = frm.elements['rank'].value;
  if (cmt.email.length > 0)
  {
     if (!(Utils.isEmail(cmt.email)))
     {
        alert(cmt_error_email);
        return false;
      }
   }
   else
   {
        alert(cmt_empty_email);
        return false;
   }

   if (cmt.content.length == 0)
   {
      alert(cmt_empty_content);
      return false;
   }

   if (cmt.enabled_captcha > 0 && cmt.captcha.length == 0 )
   {
      alert(captcha_not_null);
      return false;
   }

   Ajax.call('comment.php', 'cmt=' + cmt.toJSONString(), commentResponse, 'POST', 'JSON');
   frm.elements['content'].value = '';
   return false;
}

/**
 * 处理提交评论的反馈信息
*/
  function commentResponse(result)
  {
    if (result.message)
    {
      alert(result.message);
    }

    if (result.error == 0)
    {
      var layer = document.getElementById('ECS_COMMENT');

      if (layer)
      {
        layer.innerHTML = result.content;
      }
    }
  }

//]]>
</script>
				</div> 
				<script type="text/javascript">
		$('.CommentTab ul').find('li').click(function(){
		  $('.CommentTab ul').find('li').removeClass('active');
		  $('.CommentText').css({display:'none'});
		  $(this).addClass('active');
		  $('.CommentText').eq($(this).index()).css({display:'block'});
		});
		</script>
			</div> -->
		</div>
	</div>
</div>

<!--Begin 弹出层-加入购物车 Begin-->
<div id="fade1" class="black_overlay"></div>
<div id="MyDiv1" class="white_content">
	<div class="white_d">
		<div class="notice_t">
			<span class="fr" style="margin-top: 10px; cursor: pointer;"
				onclick="CloseDiv_1('MyDiv1','fade1')"><img src="/images/close.gif" /></span>
		</div>
		<div class="notice_c">

			<table border="0" align="center" style="margin-top:;" cellspacing="0"
				cellpadding="0">
				<tr valign="top">
					<td width="40"><img src="/images/suc.png" /></td>
					<td><span
						style="color: #3e3e3e; font-size: 18px; font-weight: bold;">宝贝已成功添加到购物车</span><br />
						 购物车共有<span class='cart_total'><?=Yii::$app->view->params['cartCount']?></span>种宝贝 &nbsp; &nbsp;</td>
				</tr>
				<tr height="50" valign="bottom">
					<td>&nbsp;</td>
					<td><a href="/user/cart.html" class="b_sure">去购物车结算</a><a href="javascript:;" onclick="CloseDiv_1('MyDiv1','fade1')" class="b_buy">继续购物</a></td>
				</tr>
			</table>

		</div>
	</div>
</div>
<script language="javascript">
function updatenum(type){
	var qty = parseInt(document.forms['ECS_FORMBUY'].elements['number'].value);
	if(type == 'del'){
		if(qty > 1){
			document.forms['ECS_FORMBUY'].elements['number'].value = (qty - 1);
		}
	}else{
		document.forms['ECS_FORMBUY'].elements['number'].value = (qty + 1);
	}
	//changePrice();
}
function dorank(rank_id){
    var rank_id;
	$("#rank").val(rank_id);
}
function send_cooment(){
    $(".commentBox").toggle();
}
function checkLength(which) {
	var maxChars = 1000; //
	if(which.value.length > maxChars){
		alert("您出入的字数超多限制!");
		which.value = which.value.substring(0,maxChars);
		return false;
	}else{
		var curr = maxChars - which.value.length; //250 减去 当前输入的
		document.getElementById("sy").innerHTML = curr.toString();
		return true;
	}
}
</script>